package sz.szsmk.citizencard.ui.dialogs;

import android.app.Activity;
import android.app.Dialog;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;

import sz.szsmk.citizencard.R;

/**
 * Copyright (c)2021/6/25
 * author: hxh
 * created on: 2021/6/25 14:58
 * description:
 */
public class PermissionDialog {
    private View view;
    private String text;
    private Dialog dialog;

    public PermissionDialog(String text) {
        this.text = text;
    }

    public View showDialog(Activity context){
        dialog = new Dialog(context, R.style.Translucent_NoTitle);
        view = LayoutInflater.from(context).inflate(R.layout.policy_dialog, null);
        ImageView close = view.findViewById(R.id.policy_refuse);
        ImageView agree = view.findViewById(R.id.policy_agree);
        TextView textView = view.findViewById(R.id.policy_text);
        textView.setText(text+"");

        close.setOnClickListener(v -> {
            dialog.dismiss();
        });
        agree.setOnClickListener(v -> {
            dialog.dismiss();
        });
        dialog.setCancelable(false);
        dialog.setContentView(view);
        dialog.show();

        return view;
    }

}
